package breeze.pixel.weather.weather_forecast.presenter;

import android.content.Context;

import breeze.pixel.weather.adapter.AppWeatherManager;
import breeze.pixel.weather.adapter.IAppWeatherHelper;
import breeze.pixel.weather.adapter.weather.DailyWeatherAdapter;
import breeze.pixel.weather.main_view.model.HeWeatherErrorCode;
import breeze.pixel.weather.weather_forecast.view.WeatherForecastView;

public class WeatherForecastPresenter implements IWeatherForecastPresenter {
    private final WeatherForecastView View;

    public WeatherForecastPresenter(Context context, WeatherForecastView view) {
        this.View = view;
    }

    @Override
    public void getWeatherForecast(String location) {
        IAppWeatherHelper helper = AppWeatherManager.getHelper();
        helper.getDailyWeather(location, 15, new IAppWeatherHelper.DailyWeatherResponse() {
            @Override
            public void success(DailyWeatherAdapter data) {
                View.setListData(data.getDaily());
            }

            @Override
            public void fail(String err) {

            }
        });
    }
}
